<!----------------引入头部文件-------------------->
<include file="Common/title" />
<style>
    .count{
        display:none;
    }
</style>
<script type="text/javascript">
    mui.init()
</script>
</head>
<body>
<header class="mui-bar mui-bar-nav">
    <a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left"></a>
    <h1 class="mui-title">个人中心</h1>
</header>
<div class="mui-content">
    <div class="mui-card" style="margin:10px 0;">
        <ul class="mui-table-view mui-table-view-chevron">
            <li class="mui-table-view-cell mui-media">
                <a class="mui-navigate-right">
                    <img class="mui-media-object mui-pull-left img" src="__PUBLIC__/mui/images/cbd.jpg">
                    <div class="mui-media-body">
                        <span class="name">名称</span>
                        <p class='mui-ellipsis'>电话</p>
                    </div>
                </a>
            </li>
        </ul>
    </div>
    <div class="mui-card" style="margin:10px 0;">
        <ul class="mui-table-view">
            <li class="mui-table-view-cell" >
                <a class="mui-navigate-right" href="{:U('kefu_msg',array('userid'=>$userid,'type'=>'yonghu'))}">
                    <span class="mui-badge mui-badge-danger count"> </span>
                    我的消息
                </a>
            </li>
        </ul>
    </div>
    <div class="mui-card" style="margin:10px 0;">
        <ul class="mui-table-view">
            <li class="mui-table-view-cell"  >
                <a class="mui-navigate-right" href="{:U('Collect/collect',array('userid'=>$userid))}">
                    <!--<span class="mui-badge mui-badge-primary">6</span>-->
                    收藏信息
                </a>
            </li>
            <li class="mui-table-view-cell" >
                <a class="mui-navigate-right" href="{:U('History/history',array('userid'=>$userid))}">
                    <!--<span class="mui-badge mui-badge-primary">14</span>-->
                    浏览足记
                </a>
            </li>
        </ul>
    </div>
</div>

<include file="Common/nav"/>
</body>
</html>
<script>
    var userid = '{$userid}';//当前用户ID
    function get_user_wd_count(userid){
        var span = $('.count');
        $.ajax({
            url : '/Home/Online/get_wd_znum',
            type : 'get',
            data : {userid:userid,type:'kehu'},
            success : function(e){
                //alert(e);
                if( e > 0 ){
                    span.html(e);
                    span.show();
                }
            }
        })
    }
    function get_user_detail(userid){
        $.ajax({
            url : '/Home/User/get_user_detail',
            type : 'get',
            data : {userid:userid},
            success : function(e){
                //console.log(e);
                var avatar = e.avatar;
                var name = e.name;
                var tel = e.mobile;

                $('.img').attr('src', avatar);
                $('.name').html(name);
                $('.mui-ellipsis').html(tel);
            }
        })

    }
    mui.ready(function(){
        //获取头像,名称,手机号
        get_user_detail(userid);
        //获取未读消息总数
        get_user_wd_count(userid);

    });
</script>
